home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CTRACE2_ / CTRACE.H < prev    next >
Text File  |  1990-12-10  |  3KB  |  69 lines

  1. /*****     
  2. CTRACE: A MESSAGE LOGGING CLASS
  3. by William D. Cramer in Dr. Dobbs Journal #170, p. 44-55, 116-120.
  4. *****/
  5.  
  6. /** CTrace.h -- Definitions for using the Trace class **/
  7.  
  8. #define _H_CTrace
  9.  
  10. /* System/library header files */
  11. #include <Commands.h>        /* standard menu command definition */
  12. #include <oops.h>        /* standard OOP definitions */
  13. #include <stdarg.h>        /* varg macro definitions */
  14. #include <CDesktop.h>        /* definitions for desktop class */
  15. #include <CBartender.h>     /* definitions for menu bar manager */
  16. #include <CDataFile.h>        /* definitions for data file class */
  17. #include <CApplication.h>    /* definitions for the application class */
  18. #include <CDocument.h>        /* definitions for parent class */
  19. #include <Constants.h>        /* miscellaneous environment constants */
  20.  
  21. /* Local header files */
  22. #include "CLogPanorama.h"    /* definitions for logging panorama class */
  23.  
  24. /* Resource numbers */
  25. #define TRACE_MENU_ID      (2000)      /* menu resource ID */
  26. #define TRACE_MENU_SHOW   (2000L)     /* menu command for show/hide log */
  27. #define TRACE_MENU_MASK   (2001L)     /* menu command for log masking */
  28. #define TRACE_WINDOW_ID   (2000)      /* main window resource ID */
  29. #define TRACE_MASK_DIALOG (2000)      /* resource ID for dialog box */
  30. #define FIRST_MASK       (3)           /* item # of first checkbox in dialog */
  31. #define LAST_MASK       (34)          /* item # of last checkbox in dialog */
  32. #define UNHILITE_CONTROL   (255)      /* magic part # for disabling control */
  33. #define OKAY_BUTTON_ITEM    (1)          /* item # for the 'okay' button */
  34. #define CANCEL_BUTTON_ITEM  (2)          /* item # for the 'cancel' button */
  35.  
  36. /* Standard trace categories */
  37. #define T_ERROR     (0x00000001)        /* serious error */
  38. #define T_WARNING    (0x00000002)        /* mildly serious problem */
  39. #define T_INFO        (0x00000004)        /* news you can use */
  40. #define T_FUNC_IN    (0x00000008)        /* function entry */
  41. #define T_FUNC_OUT    (0x00000010)        /* function exit */
  42.  
  43. /* Other constants */
  44. #define MAX_USER_BUFF (MAX_LOGREC_CHAR-19+1)  /* max length of user message */
  45. #define TRACE_DEFAULT_MASK    (0L)          /* initial trace mask */
  46.  
  47. /* External references */
  48. extern CDesktop     *gDesktop;        /* the whole desktop view */
  49. extern CApplication    *gApplication;        /* the application object */
  50. extern CBartender    *gBartender;        /* the menu bar object */
  51. extern OSType        gSignature;        /* application signature */
  52.  
  53. struct CTrace : CDocument
  54. {
  55.     /* local instance variables */
  56.     CLogPanorama  *itsLogPanorama; /* panorama for trace messages */
  57.     unsigned long currMask;        /* currently enabled trace categories */
  58.     /* local class methods */
  59.     void    ITrace(short records);
  60.     void    ToggleTraceWindow(void);
  61.     void    SetTraceMask (void);
  62.     void    Trace (unsigned long mask, char *format, ...);
  63.     Boolean IsItVisible(void);
  64.     /* inherited methods overriden */
  65.     void    UpdateMenus (void);
  66.     Boolean DoSaveAs (SFReply *macSFReply);
  67.     Boolean Close (Boolean quitting);    
  68. };
  69.